﻿@using System
@using MZBlog.Core.Documents
@using MZBlog.Core.Extensions
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<MZBlog.Core.ViewProjections.Admin.AllBlogCommentsViewModel>
@{
    Layout = "_AdminLayout.cshtml";
}
<div class="row">
    <ol class="breadcrumb">
        <li><i class="fa fa-dashboard"></i> <a href="~/mz-admin">控制面板</a> </li>
        <li class="active"><i class="fa fa-comments"></i> 评论管理</li>
    </ol>
</div>
<div class="row">
    <table class="table table-bordered table-condensed table-striped">
        <thead>
            <tr>
                <th></th>
                <th>评论</th>
                <th></th>
                <th class="text-center" style="width:46px;"></th>
            </tr>
        </thead>
        <tbody>
            @foreach (var blogComment in Model.Comments)
            {
                <tr>
                    <td class="text-center">
                        <img src="@blogComment.Avatar" alt="@blogComment.NickName" width="40" />
                        <br />
                        @blogComment.NickName
                    </td>
                    <td>
                        <code>@blogComment.CreatedTime.ToChineseTime().ToString("yyyy-MM-dd HH:mm")</code>
                        @blogComment.Content
                    </td>
                    <td>
                        <strong>Email:</strong> @blogComment.Email<br />
                        <strong>IP:</strong> @blogComment.IPAddress <br />
                        <strong>主页:</strong> @blogComment.SiteUrl
                    </td>
                    <td>
                        <a href="~/mz-admin/comments/delete/@blogComment.Id" class="btn btn-danger btn-xs">删除</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <ul class="pager">
        @if (Model.HasPrevPage)
        {
            <li class="previous">
                @if (Model.Page == 2)
                {
                <a href="~/mz-admin/comments/" title="较新的"><i class="glyphicon glyphicon-arrow-left"></i></a>
                }
                else
                {
                <a href="~/mz-admin/comments/@(Model.Page - 1)" title="较新的"><i class="glyphicon glyphicon-arrow-left"></i></a>
                }
            </li>
        }
        <li class="next">
            @if (Model.HasNextPage)
            {
                <a href="~/mz-admin/comments/@(Model.Page + 1)" title="较旧的"><i class="glyphicon glyphicon-arrow-right"></i></a>
            }
        </li>
    </ul>

</div>